import { Session, Local } from "@/utils/StorageData";

/**
 * 授权令牌
 * 刷新令牌
 * 用户信息
 */
export const AuthStorage = {
    setAccessToken(token, life){
        Local.set('LAB-TOKEN', token, life);
    },
    setRefreshToken(refreshToken, life){
        Local.set('LAB-REFRESH', refreshToken, life);
    },
    setUserInfo(userInfo){
        Session.set('LAB-USER', userInfo);
    },
    getAccessToken(){
        return Local.get('LAB-TOKEN');
    },
    getRefreshToken(){
        return Local.get('LAB-REFRESH');
    },
    getUserInfo(){
        return Session.get('LAB-USER');
    },
    removeToken(){
        Local.remove('LAB-TOKEN')
    },
    clear(){
        Session.remove('LAB-USER')
        Local.remove('LAB-TOKEN')
        Local.remove('LAB-REFRESH')
    }
}